package com.xywl;

import jdk.internal.util.xml.impl.Input;

import java.io.*;
import java.nio.Buffer;
import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Locale;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception{
        //byte a=123;//-128~+127
        //short b=1234;//-32768~+32767
        //int c=123456789;//-2147483648~+2147483647
        //long d=22135654561565L;//-2^32~+2^32-1
        //float e=1.2f;//1.2默认double
        //double f=1.2,g=1.2D;
        //boolean h=false;
        //final char s='A';//const~final
        //System.out.println();//简写sout+tab
        /*隐式转换
        int x=12;
        double y=x;
        从低到高（精度）
         */
        /*Scanner sc=new Scanner(System.in);
        String str=sc.next();//读入字符串
         */
        /*
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));//抛异常
        String str=br.readLine();
        int x=br.read();//读入一个字符的int类型
        System.out.println(str);
        System.out.println(x);
        */
        /*
        System.out.println("gfwhfwrfjrf");
        System.out.println(123);//ln==endl;
        */
        //System.out.printf("%.2f %04d\n",1.222,12);
        /*BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));//抛异常
        bw.write("hell13213");
        bw.flush();//刷新缓冲区，不然没输出
         */
        /*
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int x=Integer.parseInt(br.readLine());//读入整数
        System.out.println(x);
         */
        /*
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] strs=br.readLine().split(" ");
        int x=Integer.parseInt(strs[0]),y=Integer.parseInt(strs[1]);
        System.out.println(x);//读入xxx yyy1
         */



        /*
       Scanner sc=new Scanner(System.in);
       int a=sc.nextInt() ,b=sc.nextInt();
        System.out.println(a+b);
         */
        /*
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt();
        System.out.println(a*b-c*d);
        */
        /*java里可以用%s输出string类型*/
        /*
        int[] a=new int[5];
        int n=10;
        float[] b=new float[5];
        char[] c={'a','b','c'};
        char[] d=c;//引用
        System.out.println(c.hashCode());
        System.out.println(d.hashCode());//取地址
        */
        /*
       int[][] a=new int[2][3];
       a[1][2]=3;
       System.out.println(Arrays.deepToString(a));//显示数组,toString一维
        */
        /*int[] a=new int[10];
        for(int i=0;i<a.length;i++)
            a[i]=10;

         */
      /* int[] a={2,1,5,3,4};
        Arrays.sort(a);
        System.out.println(Arrays.toString(a));
        */
        /*
        int[] a={1,2,3,4,5};
        Arrays.fill(a,100);//替换100
        System.out.println(Arrays.toString(a));

         */
        /*
        Integer[] a={1,5,4,2,3};
        Arrays.sort(a,(x,y)->y-x);//需要用对象来存//正则表达式
        System.out.println(Arrays.toString(a));

         */
        //java里判断字符串相等a.equal("ghg")最好写"ghg".equal(a),因为a可能为空
        /*String a="hello world";
        String b="666";
        String x=b;//和c++不一样，是引用没开空间
        String c=b+"555";
        String d="my age is "+18;//默认将18转为字符类型
        String str=String.format("my age is %d",18);//sprintf
        String pi_str="3.1441414";
        double pi=Double.parseDouble(pi_str);
        Integer.parseInt();
        Float.parseFloat();
        Long.parseLong();

        System.out.println(pi);*/
        /*
        String a="hello ";
        System.out.println(a.hashCode());
        a+="world";
        System.out.println(a.hashCode());//不是在原字符串上加而是重开string不可修改
        */
        /*
        String a="hello world";
        for (int i = 0; i < a.length(); i++) {
            System.out.print(a.charAt(i));//a[i]
        }
        */
        /*
        String a="hello world";
        String[] strs=a.split(" ");//分割字符串
        System.out.println(Arrays.toString(strs));
        System.out.println(a.indexOf("wo"));//查找
        */
        //java里字符串a,b比较的是地址
       /* String a="aaa",b="bbb";
        System.out.println(a.compareTo(b));//==:0;<:-1;>:1
        */
        //判断是否是以某个字符串开头
        /*String a="abcdef",b="aaa";
        System.out.println(a.startsWith("abcd"));
         */
        //删除前后空白字符
        /*String a="   aaaa    ",b="aaa";
        System.out.println(a.trim());
        */
        //转换大小写
        /*String a="vgvvhcghc";
        System.out.println(a.toUpperCase());//toLowerCase()
        */
        //替换字符或字符串
        /*
        String a="aaaa",b="bjbj";
        System.out.println(a.replace("aa","x"));

         */
        //取字串
        /*
        String a="bachabcba",b="acgv";
        System.out.println(a.substring(2,4));//左闭右开
         */
        //在原串上追加和翻转
        /*StringBuffer sb=new StringBuffer("ahccv");
        for (int i = 0; i < 100; i++) {
            sb.append("a");
        }
        sb.reverse();
        System.out.println(sb);
        */
        //每个字符往后移一位
        /*StringBuffer sb=new StringBuffer("ahccv");
        for (int i = 0; i < sb.length(); i++) {
            sb.setCharAt(i,(char)(sb.charAt(i)+1));
        }
        System.out.println(sb);
        */
        //含空格的字符串长度
        /*Scanner sc=new Scanner(System.in);
        System.out.println(sc.nextLine().length());
         */
        //输出第一个只出现一次的字母
        /*Scanner sc=new Scanner(System.in);
        String str=sc.next();
        int[] cnt=new int[26];
        for (int i = 0; i < str.length(); i++) {
            int t=str.charAt(i)-'a';
            cnt[t]++;
        }
        for (int i = 0; i < str.length(); i++) {
            int t=str.charAt(i)-'a';
            if(cnt[t]==1) {
                System.out.println(str.charAt(i));
                return;
            }
        }
        System.out.println("no");
        */
        
    }
}